<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>迭代v-for</title>
    <script src="node_modules/vue/dist/vue.js"></script>
</head>
<body>
<div id="app">
    <ul>
        <li v-for="(item,index) in dataList">
            索引：{{index}},值：{{item}}
        </li>
    </ul>

    <ul>
        <li v-for="(value,key) in user">
            {{key}}:{{value}}
        </li>
    </ul>

    <table border="1">

        <tr>
            <th>id：</th>
            <th>姓名：</th>
            <th>年龄：</th>
            <th>地址：</th>
        </tr>

        <tr v-for="(user,index) in users">
            <th>{{index+1}}</th>
            <th>{{user.name}}</th>
            <th>{{user.age}}</th>
            <th>{{user.address}}</th>
        </tr>
    </table>
</div>

<script type="application/javascript">
    var vue = new Vue({
        el: '#app',
        data: {
            dataList: [100, 200, 300, 400],
            user: {name: '小明', age: 18, address: '广州'},
            users: [{name: '小明', age: 18, address: '富士'},
                {name: '小暗', age: 21, address: '暗示'},
                {name: '小红', age: 22, address: '迭代'}]
        }
    });


</script>


</body>
</html>